package edu.zhku;

import java.io.FileInputStream;
import java.io.InputStreamReader;

public class IO_Read {
	public static void main(String args[])
	{
		FileInputStream fis = null;
		InputStreamReader isr = null;
		try {
			fis = new FileInputStream("F:\\test.txt");
			isr = new InputStreamReader(fis);
			char []buffer = new char[1024];
			while(true)
			{
				int length = isr.read(buffer);
				if(-1 == length){break;}
				String string = new String(buffer,0,length);
				System.out.println(string);
			}
		}
			catch (Exception e)
			{
				e.printStackTrace();
			}
			finally
			{
				try {fis.close();} 
				catch (Exception e){e.printStackTrace();}
				try {isr.close();} 
				catch (Exception e){e.printStackTrace();}				
			}
	}
}
